package org.skycastle.megastructure

import com.jme.scene.{Node, Spatial}
import com.jme.system.DisplaySystem

/**
 * Some kind of 3D appearance for an entity.
 *
 * Can be interactively animated or procedurally generated also.
 *
 * @author Hans Haggstrom
 */

abstract class Appearance {

  private var spatial : Spatial = null

  final def getSpatialIfExists : Spatial = spatial

  /**
   * The 3D object for this appearance.
   */
  final def getSpatial(display : DisplaySystem) : Spatial = {
    if (spatial == null) spatial = createSpatial( display )

    spatial
  }

  protected def createSpatial(display : DisplaySystem) : Spatial


}